﻿// Decompiled with JetBrains decompiler
// Type: 我的小工具.Cryptography
// Assembly: 开发辅助工具, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null
// MVID: F78E5980-5E94-4E46-ABDF-DC8C6CBF52AA
// Assembly location: K:\Tools\工具\开发辅助工具庆六一版\开发辅助工具2015-06-01\开发辅助工具.exe

using System;

namespace 我的小工具
{
  public class Cryptography
  {
    public static string EnCode(string inStr)
    {
      string str = (string) null;
      int length = inStr.Trim(' ').Length;
      int num1 = length % 3;
      int num2 = length % 9;
      int num3 = length % 5;
      int num4 = num1 + num3;
      for (int index = 1; index <= length; ++index)
      {
        str += ((char) (Convert.ToInt32(inStr[length + 1 - index - 1]) - num4)).ToString();
        num4 = num4 != num1 + num3 ? num1 + num3 : num2 + num3;
      }
      return str + new string(' ', inStr.Length - length);
    }

    public static string DeCode(string inStr)
    {
      string str = "";
      int length = inStr.Trim(' ').Length;
      int num1 = length % 3;
      int num2 = length % 9;
      int num3 = length % 5;
      int num4 = (double) length / 2.0 != (double) (int) Math.Floor((double) length / 2.0) ? num1 + num3 : num2 + num3;
      for (int index = 1; index <= length; ++index)
      {
        str += ((char) (Convert.ToInt32(inStr[length + 1 - index - 1]) + num4)).ToString();
        num4 = num4 != num1 + num3 ? num1 + num3 : num2 + num3;
      }
      return str + new string(' ', inStr.Length - length);
    }
  }
}
